%%
%% This is file `xeCJK.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xeCJK.dtx  (with options: `xeCJK,plain')
%%
%%  Version 2.4.5 (31-Jan-2012)
%%
%%  Copyright (C) Wenchang Sun <sunwch@hotmail.com>
%%
%%  This file may be distributed and/or modified under the
%%  conditions of the LaTeX Project Public License, either version 1.3
%%  of this license or (at your option) any later version.
%%  The latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%%  and version 1.3 or later is part of all distributions of LaTeX
%%  version 2005/12/01 or later.
%%
\input miniltx
\ProvidesPackage{xeCJK}
  [2012/01/31 v2.4.5 package for typesetting CJK scripts with XeTeX]
\input keyval.sty\relax
\input plnfss
\makeatletter
\RequirePackage{ifxetex}
\RequireXeTeX
\@namedef{ver@CJK.sty}{2020/01/01}
\newif\ifxeCJK@fallback@
\newif\ifxeCJK@num
\newif\ifxeCJK@fntef
\endlinechar \m@ne
\catcode "FEFF=9\relax
\def\@onefilewithoptions#1[#2][#3]#4{
  \unless\ifcsname ver@#1.#4\endcsname
    \input #1.#4\relax
  \fi}
\long\def\addto@hook#1#2{#1\expandafter{\the#1#2}}
\providecommand*\AtEndOfPackage[1]{#1}
\providecommand*\PackageWarning[2]{\typeout{#1: #2}}
\providecommand*\MessageBreak{^^J}
\def\xeCJK@StrIfEqTF#1#2{
  \ifnum\strcmp{#1}{#2}=\z@
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi}
\def\xeCJK@StrIfBlankTF#1{
  \ifnum\strcmp{\empty}{#1}=\z@
    \expandafter\@firstoftwo
  \else\ifnum\strcmp{\space}{#1}=\z@
    \expandafter\expandafter
    \expandafter\@firstoftwo
  \else
    \expandafter\expandafter
    \expandafter\@secondoftwo
  \fi\fi}
\def\xeCJKenablefallback{\xeCJK@fallback@true}
\def\xeCJKdisablefallback{\xeCJK@fallback@false}
\def\xeCJKenablechecksingle{\xeCJK@checksingletrue}
\def\xeCJKdisablechecksingle{\xeCJK@checksinglefalse}
\def\CJKspace{\xeCJK@space@true}
\def\CJKnospace{\xeCJK@space@false}
\define@key{xeCJK/options}{fallback}[true]{
  \xeCJK@StrIfEqTF{true}{#1}\xeCJKenablefallback\xeCJKdisablefallback}
\define@key{xeCJK/options}{CJKchecksingle}[true]{
  \xeCJK@StrIfEqTF{true}{#1}\xeCJKenablechecksingle\xeCJKdisablechecksingle}
\define@key{xeCJK/options}{space}[true]{
  \xeCJK@StrIfEqTF{true}{#1}\CJKspace\CJKnospace}
\define@key{xeCJK/options}{CJKnumber}[true]{
  \xeCJK@StrIfEqTF{true}{#1}\xeCJK@numtrue\xeCJK@numfalse}
\define@key{xeCJK/options}{CJKfntef}[true]{
  \xeCJK@StrIfEqTF{true}{#1}\xeCJK@fnteftrue\xeCJK@fnteffalse}
\protected\def\xeCJKsetup#1{
  \setkeys{xeCJK/options}{#1}
  \unless\ifcsname xeCJK-base-load\endcsname
    \input{xeCJK-base}
    \input{xeCJK-nfss}
    \global\@namedef{xeCJK-base-load}{xeCJK-base-loaded}
  \fi\ignorespaces}
\def\setCJKmonofont{\xeCJK@newfontfamily{\CJKttdefault}}
\let\fontencoding\setfontencoding
\let\fontfamily\setfontfamily
\let\not@math@alphabet\@gobbletwo
\def\mdseries{\setfontseries\mddefault\selectfont}
\def\bfseries{\setfontseries\bfdefault\selectfont}
\def\itshape{\setfontshape\itdefault\selectfont}
\def\slshape{\setfontshape\sldefault\selectfont}
\def\scshape{\setfontshape\scdefault\selectfont}
\def\upshape{\setfontshape\updefault\selectfont}
\def\rm{\rmfamily}    \def\sf{\sffamily}    \def\tt{\ttfamily}
\def\md{\mdseries}    \def\bf{\bfseries}    \def\up{\upshape}
\def\it{\itshape}     \def\sl{\slshape}     \def\sc{\scshape}
\def\rmdefault{cmr}   \def\sfdefault{cmss}  \def\ttdefault{cmtt}
\def\bfdefault{bx}    \def\mddefault{m}     \def\itdefault{it}
\def\sldefault{sl}    \def\scdefault{sc}    \def\updefault{n}
\def\encodingdefault{EU1}         \def\familydefault{\rmdefault}
\def\seriesdefault{\mddefault}    \def\shapedefault{\updefault}
\def\f@encoding{\@fontencoding}   \def\f@family{\@fontfamily}
\def\f@series{\@fontseries}       \def\f@shape{\@fontshape}
\def\f@size{\the\@fontsize}
\expandafter\def\expandafter\selectfont\expandafter{
  \selectfont\edef\font@name{\csname\selectedfont\endcsname}}
\def\xeCJK@map@fontfamily#1{
  \SubstFont{\encodingdefault/#1/\mddefault/\itdefault}
            {\encodingdefault/#1/\mddefault/\updefault}
  \SubstFont{\encodingdefault/#1/\mddefault/\sldefault}
            {\encodingdefault/#1/\mddefault/\updefault}
  \SubstFont{\encodingdefault/#1/\mddefault/\scdefault}
            {\encodingdefault/#1/\mddefault/\updefault}
  \SubstFont{\encodingdefault/#1/\bfdefault/\updefault}
            {\encodingdefault/#1/\mddefault/\updefault}
  \SubstFont{\encodingdefault/#1/\bfdefault/\itdefault}
            {\encodingdefault/#1/\bfdefault/\updefault}
  \SubstFont{\encodingdefault/#1/\bfdefault/\sldefault}
            {\encodingdefault/#1/\bfdefault/\updefault}
  \SubstFont{\encodingdefault/#1/\bfdefault/\scdefault}
            {\encodingdefault/#1/\bfdefault/\updefault}}
\define@key{xeCJK/features}{BoldFont}[]{\xeCJK@StrIfBlankTF{#1}{}{
  \DeclareFont{\encodingdefault/\curr@family/\bfdefault/\updefault}{"#1"()}}}
\define@key{xeCJK/features}{ItalicFont}[]{\xeCJK@StrIfBlankTF{#1}{}{
  \DeclareFont{\encodingdefault/\curr@family/\mddefault/\itdefault}{"#1"()}}}
\define@key{xeCJK/features}{BoldItalicFont}[]{\xeCJK@StrIfBlankTF{#1}{}{
  \DeclareFont{\encodingdefault/\curr@family/\bfdefault/\itdefault}{"#1"()}}}
\define@key{xeCJK/features}{SlantedFont}[]{\xeCJK@StrIfBlankTF{#1}{}{
  \DeclareFont{\encodingdefault/\curr@family/\mddefault/\sldefault}{"#1"()}}}
\define@key{xeCJK/features}{BoldSlantedFont}[]{\xeCJK@StrIfBlankTF{#1}{}{
  \DeclareFont{\encodingdefault/\curr@family/\bfdefault/\sldefault}{"#1"()}}}
\define@key{xeCJK/features}{SmallCapsFont}[]{\xeCJK@StrIfBlankTF{#1}{}{
  \DeclareFont{\encodingdefault/\curr@family/\mddefault/\scdefault}{"#1"()}}}
\define@key{xeCJK/features}{BoldSmallCapsFont}[]{\xeCJK@StrIfBlankTF{#1}{}{
  \DeclareFont{\encodingdefault/\curr@family/\bfdefault/\scdefault}{"#1"()}}}
\def\xeCJK@new@fontfamily#1[#2]#3{
  \begingroup
  \global\advance\xeCJK@family@cnt\@ne\relax
  \edef\curr@family{}
  \edef\xeCJK@temp@{\unexpanded{\@tfor\reserved@a:=}#3}
  \xeCJK@temp@\do{
    \edef\curr@family{\curr@family\xeCJK@StrIfEqTF{\reserved@a}{/}{@}{\reserved@a}}}
  \edef\curr@family{\curr@family(\number\xeCJK@family@cnt)}
  \DeclareFont{\encodingdefault/\curr@family/\mddefault/\updefault}{"#3"()}
  \setkeys{xeCJK/features}{#2}
  \xeCJK@map@fontfamily{\curr@family}
  \edef\xeCJK@temp@{\endgroup\unexpanded{\edef#1}{\curr@family}}
  \xeCJK@temp@}
\def\newfontfamily#1{\@ifnextchar[%]
  {\newfontfamily@aux{#1}}{\newfontfamily@aux{#1}[]}}
\def\newfontfamily@aux#1[#2]#3{
  \begingroup
  \xeCJK@new@fontfamily\xeCJK@temp@name[#2]{#3}
  \protected\xdef#1{
    \noexpand\setfontfamily{\xeCJK@temp@name}\noexpand\selectfont}
  \endgroup}
\def\setmainfont{\xeCJK@newfontfamily@{\rmdefault}}
\let\setromanfont\setmainfont
\def\setsansfont{\xeCJK@newfontfamily@{\sfdefault}}
\def\setmonofont{\xeCJK@newfontfamily@{\ttdefault}}
\def\xeCJK@newfontfamily@#1{\@ifnextchar[%]
  {\xeCJK@new@fontfamily{#1}}{\xeCJK@new@fontfamily{#1}[]}}
\protected\def\fontspec{\@ifnextchar[%]
  {\xeCJK@fontspec}{\xeCJK@fontspec[]}}
\newcount\xeCJK@family@cnt
\def\xeCJK@fontspec[#1]#2{
  \xeCJK@new@fontfamily\@fontfamily[#1]{#2}
  \selectfont\ignorespaces}
\protected\def\xeCJK@newfontfamily#1{\@ifnextchar[%]
  {\xeCJK@newfontfamily@aux{#1}}{\xeCJK@newfontfamily@aux{#1}[]}}
\def\xeCJK@newfontfamily@aux#1[#2]#3{
  \expandafter\gdef\csname xeCJK@family@#1\endcsname{
    \setfontfamily{\@nameuse{CJKfamily@\xeCJK@family}}\selectfont}
  \xeCJK@new@fontfamily\xeCJK@temp@name[#2]{#3}
  \expandafter\xdef\csname CJKfamily@#1\endcsname{\xeCJK@temp@name}}
\let\setCJKfamilyfont\xeCJK@newfontfamily
\def\setCJKfallbackfamilyfont#1{\xeCJK@newfontfamily{#1@FallBack}}
\def\newCJKfontfamily#1{\@ifnextchar[%]
  {\newCJKfontfamily@aux{#1}}{\newCJKfontfamily@aux{#1}[]}}
\def\newCJKfontfamily@aux#1[#2]#3{
  \begingroup
  \edef\xeCJK@temp{\expandafter\@gobble\detokenize\expandafter{\string#1}}
  \xeCJK@newfontfamily\xeCJK@temp[#2]{#3}
  \protected\xdef#1{\noexpand\CJKfamily{\xeCJK@temp}}
  \endgroup}
\def\CJKfontspec{\@ifnextchar[%]
  {\xeCJK@CJKfontspec}{\xeCJK@CJKfontspec[]}}
\def\xeCJK@CJKfontspec[#1]#2{
  \global\advance\xeCJK@family@cnt\@ne\relax
  \edef\xeCJK@fontspec@name{xeCJK@family@\number\xeCJK@family@cnt}
  \xeCJK@newfontfamily\xeCJK@fontspec@name[#1]{#2}
  \CJKfamily{\xeCJK@fontspec@name}\ignorespaces}
\endlinechar `\^^M
\endinput
%%
%% End of file `xeCJK.tex'.
